package com.example.demo3;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Test")
public class Test {
    //方法1:
    //只支持GET请求
    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String display(){
        return "Hello Spring boot";
    }
    //只支持POST请求
    @RequestMapping(value = "/hello2",method = RequestMethod.POST)
    public String display2(){
        return "Hello Spring boot2";
    }
    //方法2：
    //这里引入新的注解:@GetMapping，@PostMapping
    @GetMapping("/hello3")
    public String display3(){
        return "Hello Spring boot3";
    }
    @PostMapping("/hello4")
        public String display4(){
        return "Hello Spring boot4";
        }
        @RequestMapping("/hello5")
    public String display5(String name,Integer age){
        return "姓名"+name+" age"+age;
        }
}
